package mo.leetcode_top;

public class L1753 {

    public int maximumScore(int a, int b, int c) {
        int min = Math.min(Math.min(a, b), c);
        int max = Math.max(Math.max(a, b), c);
        int middle = (a+b+c) - min - max;
        if (min + middle <= max) {
            return middle + min;
        }
        int k = (min + middle - max) / 2 + ((min + middle - max) % 2 == 0 ? 0 : 1);
        return k + (min - k) + (middle - k);
    }

}
